package com.bwie.config;

import com.aliyun.oss.OSSClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @Author: tsh
 * @Date: 2025/7/18 19:50
 * @Description: TODO
 **/
@Configuration
@PropertySource("classpath:application.yml") //寻找配置路径
@ConfigurationProperties(prefix = "oss") //寻找前缀为oss的配置
public class OSSConfig {

//    accessKey: LTAI5tDCFCvdLUx3bsFnmL7z
//    accessSecret: 6GVBVPkj7cobi4NwFhTlYWRB1Dlhdt
//    pathSpace: oss-cn-beijing.aliyuncs.com
//    accessPath: http://oss-cn-beijing.aliyuncs.com
//    bucketName: taoshihao
//    findHost: images
    private String accessKey;
    private String accessSecret;
    private String endpoint;
    private String accessPath;
    private String bucketName;
    private String findHost;

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getAccessSecret() {
        return accessSecret;
    }

    public void setAccessSecret(String accessSecret) {
        this.accessSecret = accessSecret;
    }



    public String getAccessPath() {
        return accessPath;
    }

    public void setAccessPath(String accessPath) {
        this.accessPath = accessPath;
    }

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }

    public String getFindHost() {
        return findHost;
    }

    public void setFindHost(String findHost) {
        this.findHost = findHost;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    @Bean
    public  OSSClient ossClient(){
        return new OSSClient(endpoint,accessKey,accessSecret);
    }
}
